//
//  SSWBWebViewController.swift
//  shanshanlol微博
//
//  Created by 叶竞泽 on 2017/2/7.
//  Copyright © 2017年 JingZe. All rights reserved.
//

import UIKit

/// 网页控制器
class SSWBWebViewController: SSWBBaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        
    }
    
    fileprivate lazy var webView = UIWebView(frame: UIScreen.main.bounds)

    /// 要加载的URL字符串
    var urlString: String? {
        didSet {
            guard let urlString = urlString, let url = URL(string: urlString) else {
                return
            }
            webView.loadRequest(URLRequest(url: url))
        }
    }
}

extension SSWBWebViewController {
    
    override func setupTableView() {
        
        // 加载webView
        view.insertSubview(webView, belowSubview: navigationBar)
        
        // 设置contentInset
        webView.scrollView.contentInset = UIEdgeInsetsMake(navigationBar.bounds.height, 0, tabBarController!.tabBar.bounds.height, 0)
        
        navItem.title = "网页"
        
    }
}
